package com.game.service.game.turntable.config;

import com.game.service.app.Utils;
import com.game.service.define.RoomConfig;

import java.util.ArrayList;

public class PrizeDailyTask {
    private ArrayList<PrizeDailyInfo> prizeDailyList = new ArrayList<>();
    private ArrayList<int[]> prizeArray = new ArrayList<>();//统计每日获奖信息
    private String date;
    private long currentTimeMillis;
    private int[] _betArray;
    private long dailyTaskWin;//每日任务获得
    private long exLuckyStore;//兑换幸运商店钻石
    private String sign;

    /***每日活动,(累计场次,最少奖励,最大奖励,积分,是否达成,是否领取)10钻挡位
     * 3.75%~4.28%(1000局-游戏钻石赠送192~225,积分1830=183钻,总共投注10000钻)
     * 3.50%~3.96%(500局-游戏钻石赠送92~115,积分830=83钻,总共投注5000钻)
     * 4.00%~5.65%(200局-游戏钻石赠送42~75,积分380=38钻,总共投注2000钻)
     * 3.90%~6.20%(100局-游戏钻石赠送22~45,积分170=17钻,总共投注1000钻)*/

    public static final int[][] prizeDailys = {

            {10, 5, 10, 5, 0, 0},
            {50, 7, 15, 25, 0, 0},
            {100, 10, 20, 50, 0, 0},
            {200, 20, 30, 100, 0, 0},
            {500, 50, 60, 250, 0, 0},
            {1000, 100, 110, 500, 0, 0},
    };

    public PrizeDailyTask initPrizeDaily(int[] betArray) {
        this._betArray = betArray;
        for (int i = 0; i < _betArray.length; i++) {//初始化每日活动奖励
            final ArrayList<PrizeDaily> prizeDailyBase = getPrizeDailyList(i);
            PrizeDailyInfo prizeDailyInfo = new PrizeDailyInfo();
            prizeDailyInfo.setPrizeDailys(prizeDailyBase);
            prizeDailyInfo.setPlayCounts(0);
            prizeDailyInfo.setBetRatio("x" + _betArray[i]);
            prizeDailyList.add(prizeDailyInfo);
        }
        for (int i = 0; i < _betArray.length; i++) {//初始化每日游戏记录
            int[] prizeItemCount = new int[16];//出奖统计
            prizeArray.add(prizeItemCount);
        }
        date = Utils.getFormattedDate();
        currentTimeMillis = System.currentTimeMillis();
        sign="";//需要初始赋值
        return this;
    }


    private ArrayList<PrizeDaily> getPrizeDailyList(int index) {
        ArrayList<PrizeDaily> prizeDailyList = new ArrayList<>();


        int betNumber = _betArray[index] / 10;
        int prizeIdIndex = 0;
        for (int[] daily : prizeDailys) {
            PrizeDaily prizeDaily = new PrizeDaily();
            prizeDaily.setPrizeDailyID(prizeIdIndex++);
            prizeDaily.setPlayCounts(daily[0]);
            prizeDaily.setPrizeDiamondMin(betNumber * daily[1]);
            prizeDaily.setPrizeDiamondMax(betNumber * daily[2]);
            prizeDaily.setPrizeLuckyValue(betNumber * daily[3]);
            prizeDailyList.add(prizeDaily);
        }
        return prizeDailyList;
    }


    public ArrayList<PrizeDailyInfo> getPrizeDailyList() {
        return prizeDailyList;
    }


    public String getDate() {
        return date;
    }


    public ArrayList<int[]> getPrizeArray() {
        return prizeArray;
    }

    public void setPrizeArray(ArrayList<int[]> prizeArray) {
        this.prizeArray = prizeArray;
    }

    public long getDailyTaskWin() {
        return dailyTaskWin;
    }

    public void setDailyTaskWinAdd(long dailyTaskWin) {
        this.dailyTaskWin += dailyTaskWin;
    }

    public long getExLuckyStore() {
        return exLuckyStore;
    }

    public void setExLuckyStoreAdd(long exLuckyStore) {
        this.exLuckyStore += exLuckyStore;
    }

    public long getCurrentTimeMillis() {
        return currentTimeMillis;
    }

    public void setCurrentTimeMillis(long currentTimeMillis) {
        this.currentTimeMillis = currentTimeMillis;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }
}
